<template>
	<view class="pr">
		<image src="/static/img/my/my_page_bg.png" class="w-max pa top0" style="max-height: 100%;" mode="widthFix" />
		<u-navbar :is-back="false" :border-bottom="false" :title="$list('identity')[$user.identity]||'我的'" title-bold
			:is-fixed="false" :background="{background:'#0000'}">
			<view class="pr20 pl20 flex w-max row-right">
				<view class="w40 h40 mr20 pr" @click="$u.route('/pages/my/msg/msg')">
					<image src="/static/img/my/msg.png" class="wh-max"></image>
					<u-badge type="error" :count="$user.msg_num||0" is-center></u-badge>
				</view>
				<image src="/static/img/my/set.png" class="w40 h40" @click="$u.route('/pages/my/menu/set')"></image>
			</view>
		</u-navbar>
		<view class="pr z-index2 p20 pt0">
			<view class="ml40  p6 bg-fff radius pr z-index2" style="margin-bottom: -50rpx; width: fit-content;">
				<u-avatar size="108" :src="$user.avatar_img||''"></u-avatar>
			</view>
			<view class="p20 radius20 bg-fff my_box_shadow">
				<view class="flex col-top">
					<view class="flex1 flex pt40">
						<view class="fs30 mr16 fw-w u-line-1" style="max-width: 230rpx;">{{$user.name||"请设置昵称"}}</view>
						<view class="w134 h46 pr"  @click="$u.route('/pages/index/selectIdentity/selectIdentity')">
							<image src="/static/img/my/au.png" class="wh-max" mode=""></image>
							<view class="wh-max pa top0 left0 pl50 flex fs20 color-fff lh1">{{$user.certificate?'已认证':'未认证'}}</view>
						</view>
						<view class="w92 ml20 h36 flex row-center fs20 color-fff radius20"
							style="background-color: #0BBE04;">{{$user.work==1?'上班':'下班'}}</view>
					</view>
					<view class="radius100 border flex pl18 pr18 fs24 color-999 h52 lh1"
						@click="$u.route('/pages/my/userInfo/userInfo')">
						<view class="mr8">个人资料</view>
						<image src="/static/img/icon/edit.png" class="w24 h24 db" mode=""></image>
					</view>
				</view>
				<view class="color-666 mt10 fs26" v-if="$user.service_year">护龄：{{$user.service_year}}年</view>
				<view class="color-999 mt10 fs24 u-line-1">{{$user.profile||"请设置简介"}}</view>
			</view>
			<view class="h234 mt20 pr" v-if="$config.is_withdraw==1">
				<image src="/static/img/my/money_bg.png" class="wh-max" mode=""></image>
				<view class="pa wh-max top0 left0 p24">
					<view class="flex row-between pl154">
						<view class="">
							<view class="">账户余额（元）</view>
							<view class="mt10 color-red fw-w">
								<text class="fs24">￥</text>
								<text class="fs34">{{$user.deposit||'0'}}</text>
							</view>
						</view>
						<view class="">
							<u-button type="error" plain ripple shape="circle"
								@click="$u.route('/pages/my/balance/tixian')">提现</u-button>
						</view>
					</view>
					<view class="flex row-between mt24">
						<view class="w312 h64 radius100 bg-f7f flex row-center"
							@click="$u.route('/pages/my/balance/balance')">
							<image src="/static/img/my/sy.png" class="w36 h36 mr24" mode=""></image>
							<view class="fs24 color-666">收益明细</view>
						</view>
						<view class="w312 h64 radius100 bg-f7f flex row-center"
							@click="$u.route('/pages/my/balance/tixianLog')">
							<image src="/static/img/my/tx.png" class="w36 h36 mr24" mode=""></image>
							<view class="fs24 color-666">提现记录</view>
						</view>
					</view>
				</view>
			</view>
			<view class="color-666 p20">
				<view class="pt26 pb26 flex border-b pr" @click="click(item)" v-for="(item,index) in else_menu"
					:key='index'>
					<view class="pr w46 h46">
						<image :src="item.icon||''" class="wh-max" mode=""></image>
						<block v-if="item.msg">
							<u-badge type="error" :count="item.msg||1" is-center></u-badge>
						</block>
					</view>
					<view class="ml24 flex1">{{item.name}}</view>
					<block v-if="item.type=='wx'">
						<view class="color-zs mr20" v-if="1">已绑定</view>
						<view class="color-zs mr20" v-else>待绑定</view>
					</block>

					<u-icon name="arrow-right" size="22" />
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {

			};
		},
		computed: {
			else_menu() {
				let list = [{
						icon: '/static/img/my/menu-rzxx.png',
						name: '认证信息',
						url: '/pages/my/menu/certificate',
						identity: ['organ', 'master', ''],
					},
					{
						icon: '/static/img/my/menu-sdpj.png',
						name: '收到评价',
						url: '/pages/order/evaluate',
						identity: ['organ', 'master', ''],
					},
					{
						icon: '/static/img/my/menu-pzsfc.png',
						name: '陪诊师风采',
						url: '/pages/my/menu/style',
						identity: ['organ', 'master', ''],
					},
					{
						icon: '/static/img/my/menu-bzzx.png',
						name: '帮助中心',
						url: '/pages/my/menu/help',
						identity: ['organ', 'master', ''],
					},
					{
						icon: '/static/img/my/menu-lxpd.png',
						name: '联系平台',
						identity: ['organ', 'master', ''],
						methods: () => {
							console.log(11);
							this.$showModal('联系客服').then(res => {
								this.$tool.phone(this.$config.shop_mobile)
							})
						},
					},
					{
						icon: '/static/img/my/menu-yjfk.png',
						name: '意见反馈',
						url: '/pages/my/menu/feedback',
						identity: ['organ', 'master', ''],
					},
				]
				list = list.filter(e => e.identity?.includes(this.$user?.identity || ''))
				return list
			}
		},
		onLoad() {
			// this.$getUser()
		},
		onShow() {
			this.$getUser({route:'my'})
		},
		methods: {
			// phone,
			click(item) {
				item.methods ? item.methods() : this.$u.route(item.url)
			}
		}
	}
</script>

<style lang="scss">
	page {
		background: #fff;
	}

	.my_box_shadow {
		box-shadow: 0px 0px 2px 2px rgba(0, 0, 0, 0.07);
	}
</style>
